﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsReadFile
{
  public   class XimenziIndex
    {
        private string _type ;//length = 4 -null=3
        private string _fileName /*= "\0\0\0\0\0\0\0\0\0"*/;//length = 9- null=8
        private string _programName /*= "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"*/;//length = 27 - * = 26
        private string _contentNull = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ;//length = 25 
        private string _numberType/* = "67775"*/;//+ 67775  + null

        public string Type { get => _type; set => _type = value; }
        public string FileName { get => _fileName; set => _fileName = value; }
        public string ProgramName { get => _programName; set => _programName = value; }
        public string ContentNull { get => _contentNull; set => _contentNull = value; }
        public string NumberType { get => _numberType; set => _numberType = value; }

        //拼接字符串
        public string  Construct()
        {
            string fillnametemp;
            string programnametemp;
            if (FileName.Length < 8)
            {
                string temp = "\0\0\0\0\0\0\0\0\0";
                fillnametemp = FileName + temp.Substring(FileName.Length);
            }
            else
            {
                fillnametemp = FileName;
            }

            string temp1 = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
            programnametemp = ProgramName + temp1.Substring(ProgramName.Length);
            string resultString = Type+"\0" + fillnametemp + "\0"+ programnametemp + "*" + ContentNull + NumberType + "\0";
                return resultString;
           
        }

        //处理索引格式
        public void SetAttribute()
        {
            


           
           
        }


    }
}
